import { createStore } from 'vuex'

export default createStore({
  state: {
    list: []
  },

  mutations: {
    setList(state, list) {
      state.list = state.list.concat(list)
    }
  },
  
  actions: {
    loadData({ commit }) {
      setTimeout(() => {
        commit('setList', ['a', 'b'])
      }, 1000)
    },
    changList({ commit, state }, item) {
      commit('setList', [item])
    }
  },
  modules: {
  }
})
